package leetcode.offer_two_special.tree;

import leetcode.tree.common.TreeNode;

/**
 * @author mazouri
 * @create 2021-09-11 22:54
 */
public class _47_pruneTree {
    public TreeNode pruneTree(TreeNode root) {
        if (root == null) return null;

        root.left = pruneTree(root.left);
        root.right = pruneTree(root.right);
        if (root.left == null && root.right == null && root.val == 0) return null;

        return root;
    }
}
